home *** CD-ROM | disk | FTP | other *** search
/ Visual Cafe 3 / Visual Cafe 3.ISO / Vcafe / Main.bin / verify.h < prev    next >
C/C++ Source or Header  |  1998-09-15  |  3KB  |  101 lines

  1. /*
  2.  * @(#)verify.h    1.11 98/07/01
  3.  *
  4.  * Copyright 1995-1998 by Sun Microsystems, Inc.,
  5.  * 901 San Antonio Road, Palo Alto, California, 94303, U.S.A.
  6.  * All rights reserved.
  7.  * 
  8.  * This software is the confidential and proprietary information
  9.  * of Sun Microsystems, Inc. ("Confidential Information").  You
  10.  * shall not disclose such Confidential Information and shall use
  11.  * it only in accordance with the terms of the license agreement
  12.  * you entered into with Sun.
  13.  */
  14.  
  15. #ifndef _VERIFY_
  16. #define _VERIFY_
  17.  
  18. /*
  19.  * Limits. I have just picked some values for these, they
  20.  * probably should be more constraint.
  21.  */
  22.  
  23. #define DEFAULTMAX    (1 << 15)
  24.  
  25. #define MINCLASSSIZE    sizeof(ClassClass)
  26. #define MAXCLASSSIZE    DEFAULTMAX
  27. #define MINCONSTANTS    2
  28. #define MAXCONSTANTS    DEFAULTMAX
  29. #define MININTERFACES    0
  30. #define MAXINTERFACES    DEFAULTMAX
  31. #define MINFIELDS    0
  32. #define MAXFIELDS    DEFAULTMAX
  33. #define MINMETHODS    0
  34. #define MAXMETHODS    DEFAULTMAX
  35. #define MINATTR        0
  36. #define MAXATTR        DEFAULTMAX
  37. #define MINATTRLEN    0
  38. #define MAXATTRLEN    DEFAULTMAX
  39. #define MINCODELEN    1
  40. #define MAXCODELEN    DEFAULTMAX
  41. #define MINEXCEPTIONS    0
  42. #define MAXEXCEPTIONS    DEFAULTMAX
  43. #define MINLINENO    0
  44. #define MAXLINENO    DEFAULTMAX
  45. #define MINLOCALVAR    0
  46. #define MAXLOCALVAR    256
  47. #define MINSTRING    0
  48. #define MAXSTRING    DEFAULTMAX
  49. #define MINSTACK    0
  50. #define MAXSTACK    DEFAULTMAX
  51. #define MINLOCALS    0
  52. #define MAXLOCALS    256
  53. #define MINMETHSIZE    1
  54. #define MAXMETHSIZE    DEFAULTMAX
  55. #define MINARGSIZE    0
  56. #define MAXARGSIZE    256
  57.  
  58. typedef unsigned char     uchar;
  59.  
  60. /*
  61.  * data
  62.  */
  63. extern int verify_verbose;
  64. extern int verify_errors;
  65. extern char verify_error_message[];
  66. extern char * const opnames[];
  67.  
  68. /*
  69.  * functions
  70.  */
  71.  
  72. extern long get_ubyte(uchar *ptr);
  73. extern long get_ushort(uchar *ptr);
  74. extern long get_uint(uchar *ptr);
  75. extern long get_byte(uchar *ptr);
  76. extern long get_short(uchar *ptr);
  77. extern long get_int(uchar *ptr);
  78.  
  79. extern long read_ubyte(uchar **pptr);
  80. extern long read_ushort(uchar **pptr);
  81. extern long read_uint(uchar **pptr);
  82. extern long read_byte(uchar **pptr);
  83. extern long read_short(uchar **pptr);
  84. extern long read_int(uchar **pptr);
  85.  
  86. extern int verify_field_signature(char *sig, int len);
  87. extern int verify_method_signature(char *sig, int len);
  88.  
  89. extern int verify_Asciz(int nconstants, uchar **cpool, uint n);
  90. extern int verify_Class(int nconstants, uchar **cpool, uint n);
  91. extern int verify_NameAndType(int nconstants, uchar **cpool, uint n);
  92. extern int verify_Fieldref(int nconstants, uchar **cpool, uint n);
  93. extern int verify_Methodref(int nconstants, uchar **cpool, uint n);
  94. extern int verify_InterfaceMethodref(int nconstants, uchar **cpool, uint n);
  95.  
  96. extern void verify_error(char *fmt, ...);
  97. extern int verify_data(uchar *data, int length);
  98. extern int verify_code(int nconst, uchar **cpool, int name, int sig, uchar *data, int length);
  99.  
  100. #endif
  101.